Skip to content

Conversation

@Ukj0ng
Copy link
Contributor

@Ukj0ng Ukj0ng commented Jan 22, 2026

🧷 문제 링크

https://www.acmicpc.net/problem/15681

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

각 트리의 서브쿼리의 노드 개수를 구하시오.

🔍 풀이 방법

처음엔 BFS로 구하려고 했는데, 모든 상태를 전이하는 것이 말이 안됐다.

DFS로 바텀업 형식으로 구현했다.

for (int next : graph[start]) {
        if (visited[next]) continue;
        countSubNodes(next);
        nodes[start] += nodes[next];
}

⏳ 회고

트리부분을 하기 싫었는데 이제 시작한다.

@ShinHeeEul ShinHeeEul merged commit e0731da into main Jan 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants